/*
 * Copyright (c) ShaoxiongDu <Shaoxiong.dev@aliyun.com> 2021 all Rights Reserved
 */

package zh.codegym.task.task06.task0603;

/* 
Cat 和 Dog 对象：各有 50000 个对象
*/

public class Solution {
    public static void main(String[] args) {
        // 在此编写你的代码
        int num = 50000;
        for (int a = 0; a < num; a++) {
            Cat cat = new Cat();
            Dog dog = new Dog();
        }
    }
}

class Cat {
    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        System.out.println("一个 Cat 被销毁");
    }
}

class Dog {
    @Override
    protected void finalize() throws Throwable {
        super.finalize();
        System.out.println("一个 Dog 被销毁");
    }
}